/**
 * This file is part of the CAKIS project.
 * 
 * Copyright (c) 2009-2010 - Florian Arndt, Christian Kerl
 * 
 * @license GNU Lesser General Public License v3 <http://www.opensource.org/licenses/lgpl-3.0.html>
 * @since   27.04.2010
 * @version SVN: $Id: ProductListServiceImpl.java 89 2010-04-27 11:50:30Z christian-kerl@web.de $
 */
package org.cakis.server.service.impl;

import java.util.List;

import javax.ejb.Stateless;

import org.cakis.server.Names;
import org.cakis.server.model.ProductList;
import org.cakis.server.model.repository.ProductListRepository;
import org.cakis.server.service.ProductListService;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;

/**
 * ProductListServiceImpl
 *
 * @author Christian Kerl
 */
@Stateless
@Name(Names.ProductListService)
@Scope(ScopeType.APPLICATION)
@Startup
public class ProductListServiceImpl implements ProductListService.Local {
    private ProductListRepository productListRepository;

    @In(Names.ProductListRepository)
    public void setProductRepository(ProductListRepository productListRepository) {
        this.productListRepository = productListRepository;
    }

    @Override
    public ProductList getProductListWithContent(Long productListId) {
        return productListRepository.findByIdAndFetch(productListId);
    }

    @Override
    public List<ProductList> getProductLists() {
        return productListRepository.findNonArchived();
    }
}
